package cn.chuan.keygen.module.verify.dal.mysql.card;


import cn.chuan.keygen.framework.common.pojo.PageResult;
import cn.chuan.keygen.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.chuan.keygen.framework.mybatis.core.mapper.BaseMapperX;
import cn.chuan.keygen.module.verify.dal.dataobject.card.CardDO;
import org.apache.ibatis.annotations.Mapper;
import cn.chuan.keygen.module.verify.controller.admin.card.vo.*;

/**
 * 充值卡 Mapper
 *
 * @author chuan
 */
@Mapper
public interface CardMapper extends BaseMapperX<CardDO> {

    default PageResult<CardDO> selectPage(CardPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CardDO>()
                .eqIfPresent(CardDO::getCardDeviceNumber, reqVO.getCardDeviceNumber())
                .eqIfPresent(CardDO::getCardNumber, reqVO.getCardNumber())
                .eqIfPresent(CardDO::getSellStatus, reqVO.getSellStatus())
                .eqIfPresent(CardDO::getUseStatus, reqVO.getUseStatus())
                .orderByDesc(CardDO::getId));
    }

}